<template>
    <div class="d_flex">
        <div v-bind:class="[isSuccess?'success':'fail','main_content pt44']">
            <div class="result_img"></div>
            <div class="result_explain">
                <p class="result_msg1"><img v-bind:src="this.$store.state.imagesUrl+result_icon"><span>{{result_msg}}</span></p>
                <p>{{this.$store.state.result_msg2}}</p>
                <p v-if="isSuccess"><a href="javascript:;" @click="toRecord" class="weui-btn weui-btn_plain-primary">交易记录查询</a></p>
            </div>
        </div>
        <div class="prompt_content">
            安全提醒：小通闪贷不会以系统维护、交易异常等为理由，要求您通过点击链接或者其他方式进行操作，或以各种理由索取您的隐私信息，如个人身份信息、银行卡账号、密码及手机验证码等。
        </div>
    </div>
</template>

<script>
export default  {
    name: 'info',  // 组件申请贷款结果
    data () {  // 数据
        return {
            msg: 'info',
            result_icon:"",
            result_msg:"",
            result_msg2:"",
            isSuccess: true
        }
    },
    methods:{ // 自定义方法，可对data进行处理
        initSuccess(){
            this.isSuccess = true;
            this.result_icon = "huankuanchenggong_icon_88X82.png";
            this.result_msg="交易成功";
            this.$store.state.result_msg2="";
        },
        initFail(){
            this.isSuccess = false;
            this.result_icon = "shibai_icon_46-x-46.png";
            this.result_msg="交易失败";
        },
        toRecord(){
            if(this.$store.state.channelNo == "01"){
                location.hash = "#/loanRecord";
            }else{
                location.hash = "#/accountRecord";
            }
        }
    },
    beforeMount:function  () {
        console.log("0000000000")
        if(this.$store.state.resultCode == "1"){  // 交易成功
            console.log("11111111111")
            this.initSuccess();
        }else{
            this.initFail();
        }

    },
    beforeRouteLeave(to,form,next){
        var _this = this;
        setTimeout(function  () {
            if(_this.$store.state.channelNo == "01"){
                location.hash = "#/loanRecord";
            }else{
                location.hash = "#/accountRecord";
            }
        },200)

        next(true);
    }

}
</script>

<style lang='scss' scoped>

.main_content{
    background-color: #fff;
    padding-bottom: 15px;
}

.result_img{
    height: 165px;

    background-repeat: no-repeat;
    background-position: center center;

}
.success{
    .result_img{
        background-image: url('/FuLiBao/Lenovo/static/images/chenggong_icon.png');
        background-size: 100% 100%;
    }
    .result_msg1{
        color: #2792e4;
    }

}
.fail{
    .result_img{
        background-image: url('/FuLiBao/Lenovo/static/images/shibai_icon.png');
        background-size: 97px 143px;
    }
    .result_msg1{
        color: #d81e06;
    }

}
.prompt_content{
    background: #fff;
    padding: 15px;
    margin-top: 10px;
}
.result_explain{
    margin-top: 10px;
    text-align: center;
    img{
        height:28px;
        vertical-align: text-bottom;
        margin-right: 5px;
    }
    .result_msg1{
        font-size: 24px;
        line-height: 28px;
        margin-bottom: 10px;
    }
    .prompt_content{
        background-color: #fff;
        margin-top: 10px;
    }
    .weui-btn_plain-primary{
        width: 50%;
        margin-top: 20px;
    }

}
</style>
